package com.rc.web.controller;


import com.rc.web.service.impl.QueryService;
import com.rc.web.service.impl.VivoGPTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.Objects;

@RestController
@RequestMapping("/vivoGPT")
public class VivoGPTController {

    @Autowired
    private VivoGPTService vivoGPTService;

    @Autowired
    private QueryService queryService;

    /**
     * 图片识别
     * @param audioFile 前端发送的图片文件
     * @return 返回识别出来的图片内容
     * @throws IOException
     */
    @PostMapping("/recognizer")
    public String recognizer(@RequestParam("file") MultipartFile audioFile,String user) throws Exception {
        if(Objects.equals(user, "")){
            user="这是什么，用中文详细的解析";
        }
        return vivoGPTService.testVivoGPT(audioFile,user);
    }

    /**
     * 交换改写
     * @param first
     * @param second
     * @param third
     * @return
     * @throws Exception
     */
    @GetMapping("/queryRewrite")
    public String Query(String first ,String second , String third) throws Exception {
        return queryService.QueryRewrite(first,second,third);
    }
    
}
